<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:caseDetails:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="caseDetailsList" @selection-change="handleSelectionChange">
      <el-table-column label="主键ID" align="center" prop="id" />
      <el-table-column label="案件名称" align="center" prop="casesName" />
      <el-table-column label="案件类别" align="center" prop="casesCategory" />
      <el-table-column label="承办检察官" align="center" prop="contractorName" />
      <el-table-column label="公开情况" align="center" prop="publicState" />
      <el-table-column label="流程阶段" align="center" prop="procState" />
      <el-table-column label="受理日期" align="center" prop="acceptDate" />
      <el-table-column label="到期日期" align="center" prop="dueDate" />
      <el-table-column label="审结日期" align="center" prop="conDate" />
      <el-table-column label="案件状态" align="center" prop="casesStatus" />
      <el-table-column label="部门受案号" align="center" prop="deptAcceptMark" />
      <el-table-column label="统一受案号" align="center" prop="uniteMark" />
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listCaseDetails, getCaseDetails} from "@/api/system/caseDetails"

export default {
  name: "CaseDetails",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 案件详情信息表格数据
      caseDetailsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        casesName: null,
        casesCategory: null,
        contractorName: null,
        publicState: null,
        procState: null,
        acceptDate: null,
        dueDate: null,
        conDate: null,
        casesStatus: null,
        deptAcceptMark: null,
        uniteMark: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询案件详情信息列表 */
    getList() {
      this.loading = true
      listCaseDetails(this.queryParams).then(response => {
        this.caseDetailsList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        casesName: null,
        casesCategory: null,
        contractorName: null,
        publicState: null,
        procState: null,
        acceptDate: null,
        dueDate: null,
        conDate: null,
        casesStatus: null,
        deptAcceptMark: null,
        uniteMark: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/caseDetails/export', {
        ...this.queryParams
      }, `caseDetails_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>
